//
//  CRKitSettings.m
//  TestPrj
//
//  Created by 朱铅峰 on 2020/8/18.
//  Copyright © 2020 Xing. All rights reserved.
//

#import "CRKitSettings.h"
#import "CRHeader.h"
#import "UIImage+CRKit.h"

@interface CRKitSettings()

proAssign BOOL isRight;

@end

@implementation CRKitSettings

- (instancetype)init:(BOOL)isRight {
    
    self = [super init];
    if (self) {
        _isRight = isRight;
        [self applyDefaultSettings];
    }
    return self;
}

- (void)applyDefaultSettings {
    
    [self applyDefaultTextSettings];
    [self applyDefaultAudioSettings];
    [self applyDefaultVideoSettings];
    [self applyDefaultFileSettings];
    [self applyDefaultImageSettings];
    [self applyDefaultLocationSettings];
    [self applyDefaultTipSettings];
    [self applyDefaultUnsupportSettings];
    [self applyDefaultTeamNotificationSettings];
    [self applyDefaultSuperTeamNotificationSettings];
    [self applyDefaultChatroomNotificationSettings];
    [self applyDefaultNetcallNotificationSettings];
    [self applyDefaultRepliedSettings];
}

- (void)applyDefaultRepliedSettings {
    
    _repliedSetting = [[CRKitSetting alloc] init];
    _repliedSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{9,11,0,15}") : UIEdgeInsetsFromString(@"{9,15,0,9}");
    _repliedSetting.replyedTextColor = _isRight? CRKit_UIColorFromRGB(0xE0EAFF) : CRKit_UIColorFromRGB(0x111111);;
    _repliedSetting.replyedFont      = [UIFont systemFontOfSize:14];
    _repliedSetting.showAvatar = YES;
}

- (void)applyDefaultTextSettings {
    
    _textSetting = [[CRKitSetting alloc] init:_isRight];
    _textSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{9,11,9,15}") : UIEdgeInsetsFromString(@"{9,15,9,9}");
    _textSetting.textColor = _isRight? CRKit_UIColorFromRGB(0xFFFFFF) : CRKit_UIColorFromRGB(0x000000);
    _textSetting.font      = [UIFont systemFontOfSize:16];
    _textSetting.showAvatar = YES;
}

- (void)applyDefaultAudioSettings {
    
    _audioSetting = [[CRKitSetting alloc] init:_isRight];
    _audioSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{8,12,9,14}") : UIEdgeInsetsFromString(@"{8,13,9,12}");
    _audioSetting.textColor = _isRight? CRKit_UIColorFromRGB(0xFFFFFF) : CRKit_UIColorFromRGB(0x000000);
    _audioSetting.font      = [UIFont systemFontOfSize:14];
    _audioSetting.showAvatar = YES;
}

- (void)applyDefaultVideoSettings {
    
    _videoSetting = [[CRKitSetting alloc] init:_isRight];
    _videoSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{3,3,3,8}") : UIEdgeInsetsFromString(@"{3,8,3,3}");
    _videoSetting.font      = [UIFont systemFontOfSize:14];
    _videoSetting.showAvatar = YES;
}

- (void)applyDefaultFileSettings {
    
    _fileSetting = [[CRKitSetting alloc] init:_isRight];
    _fileSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{3,3,3,8}") : UIEdgeInsetsFromString(@"{3,8,3,3}");
    _fileSetting.font      = [UIFont systemFontOfSize:14];
    _fileSetting.showAvatar = YES;
}

- (void)applyDefaultImageSettings {
    
    _imageSetting = [[CRKitSetting alloc] init:_isRight];
    _imageSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{3,3,3,8}") : UIEdgeInsetsFromString(@"{3,8,3,3}");
    _imageSetting.showAvatar = YES;
}

- (void)applyDefaultLocationSettings {
    
    _locationSetting = [[CRKitSetting alloc] init:_isRight];
    _locationSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{3,3,3,8}") : UIEdgeInsetsFromString(@"{3,8,3,3}");
    _locationSetting.textColor = CRKit_UIColorFromRGB(0xFFFFFF);
    _locationSetting.font      = [UIFont systemFontOfSize:12];
    _locationSetting.showAvatar = YES;
}

- (void)applyDefaultTipSettings {
    
    _tipSetting = [[CRKitSetting alloc] init:_isRight];
    _tipSetting.contentInsets = UIEdgeInsetsZero;
    _tipSetting.textColor = CRKit_UIColorFromRGB(0xFFFFFF);
    _tipSetting.font  = [UIFont systemFontOfSize:10.f];
    _tipSetting.showAvatar = NO;
    UIImage *backgroundImage = [[UIImage cr_imageInKit:@"icon_session_time_bg"] resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{8,20,8,20}") resizingMode:UIImageResizingModeStretch];;
    _tipSetting.normalBackgroundImage    = backgroundImage;
    _tipSetting.highLightBackgroundImage = backgroundImage;
}

- (void)applyDefaultUnsupportSettings {
    
    _unsupportSetting = [[CRKitSetting alloc] init:_isRight];
    _unsupportSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{11,11,9,15}") : UIEdgeInsetsFromString(@"{11,15,9,9}");
    _unsupportSetting.textColor = _isRight? CRKit_UIColorFromRGB(0xFFFFFF) : CRKit_UIColorFromRGB(0x000000);
    _unsupportSetting.font      = [UIFont systemFontOfSize:14];
    _unsupportSetting.showAvatar = YES;
}


- (void)applyDefaultTeamNotificationSettings {
    
    _teamNotificationSetting = [[CRKitSetting alloc] init:_isRight];
    _teamNotificationSetting.contentInsets = UIEdgeInsetsZero;
    _teamNotificationSetting.textColor = CRKit_UIColorFromRGB(0xFFFFFF);
    _teamNotificationSetting.font      = [UIFont systemFontOfSize:10];
    _teamNotificationSetting.showAvatar = NO;
    UIImage *backgroundImage = [[UIImage cr_imageInKit:@"icon_session_time_bg"] resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{8,20,8,20}") resizingMode:UIImageResizingModeStretch];
    _teamNotificationSetting.normalBackgroundImage    = backgroundImage;
    _teamNotificationSetting.highLightBackgroundImage = backgroundImage;
}

- (void)applyDefaultSuperTeamNotificationSettings {
    
    _superTeamNotificationSetting = [[CRKitSetting alloc] init:_isRight];
    _superTeamNotificationSetting.contentInsets = UIEdgeInsetsZero;
    _superTeamNotificationSetting.textColor = CRKit_UIColorFromRGB(0xFFFFFF);
    _superTeamNotificationSetting.font      = [UIFont systemFontOfSize:10];
    _superTeamNotificationSetting.showAvatar = NO;
    UIImage *backgroundImage = [[UIImage cr_imageInKit:@"icon_session_time_bg"] resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{8,20,8,20}") resizingMode:UIImageResizingModeStretch];
    _superTeamNotificationSetting.normalBackgroundImage    = backgroundImage;
    _superTeamNotificationSetting.highLightBackgroundImage = backgroundImage;
}

- (void)applyDefaultChatroomNotificationSettings {
    
    _chatroomNotificationSetting = [[CRKitSetting alloc] init:_isRight];
    _chatroomNotificationSetting.contentInsets = UIEdgeInsetsZero;
    _chatroomNotificationSetting.textColor = CRKit_UIColorFromRGB(0xFFFFFF);
    _chatroomNotificationSetting.font      = [UIFont systemFontOfSize:10];
    _chatroomNotificationSetting.showAvatar = NO;
    UIImage *backgroundImage = [[UIImage cr_imageInKit:@"icon_session_time_bg"] resizableImageWithCapInsets:UIEdgeInsetsFromString(@"{8,20,8,20}") resizingMode:UIImageResizingModeStretch];
    _chatroomNotificationSetting.normalBackgroundImage    = backgroundImage;
    _chatroomNotificationSetting.highLightBackgroundImage = backgroundImage;
}

- (void)applyDefaultNetcallNotificationSettings {
    
    _netcallNotificationSetting = [[CRKitSetting alloc] init:_isRight];
    _netcallNotificationSetting.contentInsets = _isRight? UIEdgeInsetsFromString(@"{11,11,9,15}") : UIEdgeInsetsFromString(@"{11,15,9,9}");
    _netcallNotificationSetting.textColor = _isRight? CRKit_UIColorFromRGB(0xFFFFFF) : CRKit_UIColorFromRGB(0x000000);
    _netcallNotificationSetting.font      = [UIFont systemFontOfSize:14];
    _netcallNotificationSetting.showAvatar = YES;
}


@end
